package com.x25175.file.util;

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.google.common.base.Strings;
import org.apache.commons.lang3.StringUtils;

/**
 * @author 徐佳辉
 * @date 2020/11/28 16:45
 */
public class IdCardAdd {


    public static String desensitizedIdNumber(String idNumber) {
        if (!Strings.isNullOrEmpty(idNumber)) {
            return StringUtils.left(idNumber, 6).concat(StringUtils.removeStart(StringUtils.leftPad(StringUtils.right(idNumber, 3), StringUtils.length(idNumber), "*"), "******"));
        }
        return idNumber;
    }


    public static String Phone(String phone) {
        return phone.substring(0, 3) + "****" + phone.substring(7, phone.length());
    }

}
